
<template>
<div>

        <el-form :inline="true" :model="params" class="demo-form-inline">
            <el-form-item label="工资编号">
                <el-input v-model="params.id"></el-input>
            </el-form-item>
            <el-form-item label="所属项目">
                <el-input v-model="params.p_id" @focus="pid" clearable></el-input>
            </el-form-item>
            <el-form-item label="登记人">
                <el-input v-model="params.handler_id" clearable></el-input>
            </el-form-item>
            <el-form-item label="年度">
                <el-input v-model="params.year"></el-input>
            </el-form-item>
            <el-form-item label="月份">
                <el-input v-model="params.menth"></el-input>
            </el-form-item>
             <el-form-item label="审批状态">
                <el-select v-model="params.approve_status">
                <el-option label="全部" value=""></el-option>
                <el-option label="审批通过" value="3"></el-option>
                <el-option label="审批不通过" value="2"></el-option>
                <el-option label="审批中" value="1"></el-option>
                </el-select>
            </el-form-item>
            <el-form-item>
                <el-button type="primary" @click="list">查询</el-button>
            </el-form-item>
        </el-form>

        <div >
        <font size="6" bold   style="position:relative;left:650px">项目工资列表</font>
      </div>
      <br>

      <div id="b" style="width: 100%;height: 80%;overflow-y: scroll">
            <el-table
                    :data="showData"
                    @row-click="getRow"
                    border>
                <el-table-column
                        prop="id"
                        label="编号">
                </el-table-column>
                <el-table-column
                        prop="project_name"
                        label="所属项目">
                </el-table-column>
                <el-table-column
                        prop="year"
                        label="年度">
                </el-table-column>
                <el-table-column
                        prop="menth"
                        label="月份">
                </el-table-column>
                <el-table-column
                        prop="ynumber"
                        label="应发合计">
                </el-table-column>
                <el-table-column
                        prop="snumber"
                        label="实发合计">
                </el-table-column>
                <el-table-column
                        prop="handler_id"
                        label="登记人">
                </el-table-column>
                <el-table-column
                        prop="apply_date"
                        label="登记日期">
                </el-table-column>
                <el-table-column
                        prop="approve_status"
                        label="流程状态">
                </el-table-column>
            </el-table>
            <el-divider></el-divider>
            <el-footer class="case-list-footer">
                <el-pagination
                        style="margin: 10px auto"
                        background
                        layout="total , sizes ,prev, pager, next,jumper"
                        :page-sizes="[5,10,15,20]"
                        :total="pageResult.total"
                        :page-size="pageResult.size"
                        class="pagination"
                        @current-change="handleIndexChange"
                        @size-change="handleSizeChange"
                >
                </el-pagination>
            </el-footer>
        </div>



    <!--所属项目子组件-->
<el-dialog  :visible.sync="dialogVisible"  width="50%">
<project-info-list  v-if="dialogVisible"  @row="project"></project-info-list>
</el-dialog>



  </div>
</template>

<script>

import ProjectInfoList from '../common/projectInfo/ProjectInfoList.vue';

// import LaoWuHeTong from '@/model/smj/LaoWuHeTong'
// const Laowuhetong= new LaoWuHeTong;

import XingMuGongZi from '@/model/smj/XingMuGongZi'
const xiangmugongzi = new XingMuGongZi;


export default {
  name: "LaoWuHeTongTable",
  components: {ProjectInfoList},
  directives: {},
  data() {
    return {
        laber:{},
        projectId:'',//所属项目id
        dialogVisible:false,//隐藏子组件

        pageResult:{},
        showData:[],
        params:{
            approveStatus:'3'
        },
    }
  },
  mounted() {},
  methods: {
      //开启隐藏项目子组件
      pid(){
           this.dialogVisible = true;
      },

      //响应项目组件
      project(row){
            this.params.p_id = row.projectName;
            this.projectId = row.id;//获取所属项目id
            this.dialogVisible = false;
      },

      //开启隐藏班组子组件
      labororgid(){
          this.dialogVisible2 = true;
      },
      //响应班组子组件
      provider(row){
            this.params.labor_org_id = row.provider_name;
            this.providerId = row.id;//获取所属项目id
            this.dialogVisible2 = false;
      },
      //开启隐藏员工子组件
      contractsignatory(){
          this.dialogVisible3 = true;
      },
      //响应员工子组件
      empDeptPost(row){
          this.params.contract_signatory = row.name;
          this.empId = row.id;
           this.dialogVisible3 = false;
      },
      //开启合同名称组件
      contractname(){
          this.dialogVisible4 = true;
      },
      //响应合同组件
      LaberContract(row){
          this.params.contract_name = row.contract_name;
          this.laberId = row.id;
           this.dialogVisible4 = false;
      },

      //查询
      list(){
                //projectId:'',//所属项目id
                //providerId:'',//班组id
                //empId:'',//
                //laberId:'',//
                if( this.params.p_id != '' || this.params.p_id != undefined){
                        this.params.projectId =this.projectId;
                }
                           
                xiangmugongzi.listlabersalary(this.params).then((response)=>{
                    for (let index = 0; index < response.data.data.data.records.length; index++) {
                        if(response.data.data.data.records[index].approve_status == '' || response.data.data.data.records[index].approve_status == null ){
                            response.data.data.data.records[index].approve_status ="未审批"
                        }
                        if(response.data.data.data.records[index].approve_status == 1){
                            response.data.data.data.records[index].approve_status ="审批中"
                        }
                        if(response.data.data.data.records[index].approve_status == 2){
                            response.data.data.data.records[index].approve_status ="审批不通过"
                        }
                        if(response.data.data.data.records[index].approve_status == 3){
                            response.data.data.data.records[index].approve_status ="审批通过"
                        }
                    }
                    this.pageResult =response.data.data.data
                    this.showData=response.data.data.data.records
                    //清空临时值
                    this.projectId='';
                    this.params={};

                })
            },
            getTypeId(id){
                this.params.providertype = id
                this.list()
            },
            handleIndexChange(index){
                this.params.page = index
                this.list()
            },
            handleSizeChange(size){
                this.params.size = size
                this.list()
            },
            search(){
                this.params.page=1
                this.list()
            },
            getRow(row){
                this.$router.push({path:"/XiangMuGongZiRow",query:{id:row.id}});
            }
  },

  created() {
       this.list();
  },
  
};
</script>

<style>
</style>